<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>过滤器</title>
    <script src="angularjs/angular.min.js"></script>
</head>
<body ng-app="doraApp">
    <div ng-controller="demo05Ctrl">
        <input type="text" ng-model="query"/>
        <ul>
            <li ng-repeat="user in users | filter:query">
                <h3>{{user.name}}</h3>
                <h4>{{user.des}}</h4>
            </li>
        </ul>
    </div>
<script>
    function User(name,des){
        this.name = name;
        this.des = des;
    }
    function getData(name,des,len){

        var arr = [];
        for(var i=0;i<len;i++){
            var u = new User(name+i,des+i);
            arr.push(u);
        }
        return arr;
    }

    angular.module("doraApp",[]).controller("demo05Ctrl",function($scope){
        $scope.users = getData("dora","helloWord",10);
    });
</script>
</body>
</html>